import Vue from 'vue'
import DialogView from '@/views/commonView/DialogView'
import { Message, Dialog, MessageBox } from "element-ui";

function Comfrim() {
}

let Comfrim = new Comfrim();

let fn = Comfrim.proyotype;

fn.openComfrim = function( param, backCall, dom) {
    dom = dom || document.body;

    Vue.component('Dialog', DialogView);
    let Dialog = Vue.extend({
        render(h) {
            let props = {
                type,
                title: param.text,
                show: param.show,
                dialogVisible: backCall
            }
            return h('Dialog',{props})
        },
        data() {
            return {
                show: false
            }
        }
    });
    let dialog = new Dialog();

    let vm = dialog.$mount();
    let el = vm.$el;
    //组件挂载到body下
    dom.appendChild(el);
    vm.show = true;
}

fn.openComfrimComponent = function(dom, param, component,backCall) {
    Vue.component('Dialog', DialogView);
    let Dialog = Vue.extend({
        render(h) {
            let props = {
                type,
                title: param.text,
                show: param.show,
                dialogVisible: backCall
            }
            return h('Dialog',{props})
        },
        data() {
            return {
                show: false
            }
        }
    });
    let dialog = new Dialog();

    let vm = dialog.$mount();
    let el = vm.$el;
    //组件挂载到body下
    document.body.appendChild(el);
    vm.show = true;
}

export default {
    Comfrim
}
